﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Microsoft.Office.OneNote;

namespace OneNoteFrameworkTests
{
    public abstract class PageTestBase
    {
        public OneNotePage DeserializePage(string xml)
        {
            XDocument doc = XDocument.Parse(xml);
            OneNotePage result = (OneNotePage)OneNoteSchema.Deserialize(doc.Root);

            // HACK: the page must believe it has the whole content, otherwise it will try to call
            // OneNote, and that would fail since it isn't part of a Hierarchy and has a dummy ID

            result.SetFlags(true, OneNoteObjectFlags.ContentLoaded);

            return result;
        }
    }
}
